<template>
  <el-autocomplete
    v-model="value"
    :fetch-suggestions="querySearchAsync"
    value="key"
    placeholder="请输入部门名称"
    @select="item=>{$emit('select',item)}"
  ></el-autocomplete>
</template>

<script>
import { likeName } from "@/api/dept";

export default {
  data() {
    return {
      value: ""
    };
  },
  methods: {
    querySearchAsync(queryString, cb) {
      likeName(queryString).then(res => {
        cb(res.data);
      });
    }
  }
};
</script>